package com.zlp.spring.v3.config;

import com.zlp.spring.v3.entity.PersonEntity;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
@Conditional({WindowsCondition.class})
@Configuration
public class BeanConfiguration {

    //如果WindowsCondition的实现方法返回true，则注入这个bean
//    @Conditional(WindowsCondition.class)
    @Bean(name = "bill")
    protected PersonEntity getBillInfo(){

        return new PersonEntity("bill",38);
    }

//    @Conditional(LinuxCondition.class)
    @Bean("linus")
    protected PersonEntity getBinusInfo(){

        return new PersonEntity("linus",58);
    }

}
